/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.lihle.designpatterns.model.stractural.adapter.impl;

import com.lihle.designpatterns.model.stractural.adapter.TemperatureInfo;

/**
 *
 * @author user
 */
public class TemperatureObjectReporter extends CelciusReporter implements TemperatureInfo {

    CelciusReporter calciusReporter;

    public TemperatureObjectReporter() {
        calciusReporter = new CelciusReporter();
    }

    @Override
    public double getTemperatureInf() {
        return cToF(calciusReporter.getTemperature());
    }

    @Override
    public void setTemperatureInf(double temperatureInf) {
        calciusReporter.setTemperature(fToC(temperatureInf));
    }

    @Override
    public double getTemperatureInc() {
        return calciusReporter.getTemperature();
    }

    @Override
    public void setTemperatureInc(double temperatureInc) {
        calciusReporter.setTemperature(temperatureInc);
    }

    private double fToC(double f) {
        return ((f - 32) * 5 / 9);
    }

    public double cToF(double c) {
        return ((c * 9 / 5) + 32);
    }
}
